package com.android.telephonecall.utils;


import org.greenrobot.eventbus.EventBus;

/**
 * EventBus工具类
 */
public final class EventBusHelper {

    /**
     * 注册
     *
     * @param object 订阅者
     */
    public static void register(Object object) {
        try {
            if (!EventBus.getDefault().isRegistered(object)) {
                EventBus.getDefault().register(object);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 取消注册
     *
     * @param object 订阅者
     */
    public static void unregister(Object object) {
        try {
            if (EventBus.getDefault().isRegistered(object)) {
                EventBus.getDefault().unregister(object);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
